'use strict';
function compare(value1,value2){
  return value1-value2;
}
function rank_by_two_large_one_small(collection){
  collection.sort(compare);
  console.log(collection);
  for(let i=0;i<collection.length;i++){
    if(i%3==0&&collection[i+2]!=null&&collection[i+2]!=undefined){
      let element=collection[i];
      collection.splice(i,1);
      collection.splice(i+2,0,element);
    }
  }
  console.log(collection);
  return collection;
}
module.exports = rank_by_two_large_one_small;
rank_by_two_large_one_small([2, 8, 1, 9, 6, 4, 3, 10]);